package gui;

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

@SuppressWarnings("serial")
public class welcomeScreenGUI extends JFrame implements ActionListener 
{
	private JPanel p1, p2, p3;
	private JLabel l1, l2;
	private JButton exit, cont;
	
	public welcomeScreenGUI() 
	{
		
		super("Welcome Screen");
		this.setSize(840, 500);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setLayout(new BorderLayout());
		this.setLocationRelativeTo(null);
		this.setResizable(false);
		
		//Panel 1
		p1 = new JPanel();
		l1 = new JLabel("Welcome to MilkRun");
		l1.setFont(new Font("serif",Font.BOLD,26));
		p1.add(Box.createRigidArea(new Dimension(0,100)));
		p1.add(l1);	
		
		//Panel 2
		p2 = new JPanel();
		l2 = new JLabel("As this is your first visit you will need to complete an initial setup process.");
		p2.add(Box.createRigidArea(new Dimension(0,100)));
		p2.add(l2);	
		
		//Panel 3
		p3 = new JPanel();
		exit = new JButton("Exit");
		exit.addActionListener(this);
		cont = new JButton("Continue");
		cont.addActionListener(this);
		p3.add(exit);
		p3.add(Box.createRigidArea(new Dimension(200,200)));
		p3.add(cont);
		
		//Adding Panels to the page
		this.add(p1, BorderLayout.NORTH);
		this.add(p2, BorderLayout.CENTER);
		this.add(p3, BorderLayout.SOUTH);
	
	}
	
	
	public static void main(String args[]) 
	{
		welcomeScreenGUI ws = new welcomeScreenGUI();
		ws.setVisible(true);
	}

	@Override
	public void actionPerformed(ActionEvent ae) 
	{
		if(ae.getSource()==exit)
		{
			System.exit(0);
		}
		if(ae.getSource()==cont)
		{
			securityGUI s=new securityGUI();
			s.setVisible(true);
			this.setVisible(false);
		}

	}

}
